<template>
  <div>
    <div class="main" v-for="item in detail" :key="item.id">
      <div class="head">
        <h1>{{item.title}}</h1>
        <h3>发表时间：{{item.add_time.substring(0,10)}}</h3>
        <h4>点击次数：{{item.click}}</h4>
      </div>
      <div class="content" v-html="item.content"></div>
    </div>
    <ping-lun></ping-lun>
  </div>
</template>
<script>
export default {
  data() {
    return {
      detail: []
    }
  },
  created() {
    this.getDetail()
  },
  methods: {
    async getDetail() {
      const { data: res } = await this.$http.get(
        '/api/getnew/' + this.$route.params.id
      )
      if (res.status !== 0) {
        return false
      }
      this.detail = res.message
    }
  }
}
</script>
<style scoped>
.main {
  padding: 0 10px;
  margin-bottom: 50px;
}
.head {
  border-bottom: 1px solid #ccc;
  color: blue;
  overflow: hidden;
}
.head h1 {
  text-align: center;
  font-size: 14px;
}
.head h3 {
  display: block;
  float: left;
}
.head h4 {
  display: block;
  float: right;
}
</style>
